package DailySheet.CourseManage;

import hepengfei.SQL.SQLInterface;
import android.R.string;
import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;
import android.media.RingtoneManager;
import android.net.Uri;
import autoRefuse.*;

public class Profile {
	private int ID;
	boolean Vibrate;
	String URI;
	int VolumeMedia, VolumeBell, VolumeMsg, Mode;
	int RePlyID, ReplyType;
	String PNname;

	public Profile(int ID, boolean Vibrate, String URI, int VolumeMedia,
			int VolumeBell, int VolumeMsg, int Mode, int ReplyID,
			int ReplyType, String Pname) {
		this.ID = ID;
		this.Vibrate = Vibrate;
		this.URI = URI;
		this.VolumeMedia = VolumeMedia;
		this.VolumeBell = VolumeBell;
		this.VolumeMsg = VolumeMsg;
		this.Mode = Mode;
		this.RePlyID = ReplyID;
		this.ReplyType = ReplyType;
		this.PNname = Pname;
	}

	public Profile(boolean Vibrate, String URI, int VolumeMedia,
			int VolumeBell, int VolumeMsg, int Mode, int ReplyID,
			int ReplyType, String Pname) {
		this(0, Vibrate, URI, VolumeMedia, VolumeBell, VolumeMsg,
				Mode, ReplyID, ReplyType, Pname);
	}

	public int getID() {
		return ID;
	}

	public boolean getVibrae() {
		return Vibrate;
	}

	public String getURI() {
		return URI;
	}

	public int getVolumeMedia() {
		return VolumeMedia;
	}

	public int getVolumeBell() {
		return VolumeBell;
	}

	public int getVolumeMsg() {
		return VolumeMsg;
	}

	public int getMode() {
		return Mode;
	}

	public int getReplyID() {
		return RePlyID;
	}

	public int getReplyType() {
		return ReplyType;
	}

	public String getPName() {
		return PNname;
	}

	public void setProfile(Activity aAc) {
		if (this.Mode == 0) {
			AudioManager mAudio = (AudioManager) aAc
					.getSystemService(Context.AUDIO_SERVICE);
			mAudio.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
		} else if (this.Mode == 1) {
			AudioManager mAudio = (AudioManager) aAc
					.getSystemService(Context.AUDIO_SERVICE);
			mAudio.setRingerMode(AudioManager.RINGER_MODE_SILENT);
		} else if (this.Mode == 2) {
			AudioManager mAudio = (AudioManager) aAc
					.getSystemService(Context.AUDIO_SERVICE);
			mAudio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
			if (Vibrate) {
				mAudio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
						AudioManager.VIBRATE_SETTING_ON);
				mAudio.setVibrateSetting(
						AudioManager.VIBRATE_TYPE_NOTIFICATION,
						AudioManager.VIBRATE_SETTING_ON);
			} else {
				mAudio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
						AudioManager.VIBRATE_SETTING_OFF);
				mAudio.setVibrateSetting(
						AudioManager.VIBRATE_TYPE_NOTIFICATION,
						AudioManager.VIBRATE_SETTING_OFF);

			}
			Uri myUri = Uri.parse(URI);
			RingtoneManager.setActualDefaultRingtoneUri(aAc,
					RingtoneManager.TYPE_RINGTONE, myUri);
			mAudio.setStreamVolume(AudioManager.STREAM_RING, VolumeBell, 0);
		}
		// SQLInterface interface1 = new SQLInterface(Profile.);
		if (ReplyType == 1) {
			SQLInterface sqlInterface = new SQLInterface(aAc);
			String ResfuseMsg = sqlInterface.FindContent_MsgReply(ID);
			AutoRefuseInit autoRefuseInit = new AutoRefuseInit();
			autoRefuseInit.init(true, ResfuseMsg);
		}
	}
}
